/* JavaScript content from scripts/console/controllers/loginCtrl.js in folder common */
define(["./../controllers/controllers"], function (controllers) {
    "use strict";

    controllers.controller("loginCtrl", ["$scope", "$state", "$localStorage", "$ionicLoading", "$timeout",
        function ($scope, $state, $localStorage, $ionicLoading, $timeout) {

            //$scope.getUUID = function() {
            //    var exec = cordova.require('cordova/exec');
            //    exec(toBack, toBack, "ThirdLoginPlugin",
            //        "checkNetStates", []);
            //}
            //$scope.getUUID();
            function toBack(uuid) {
                alert("ios返回的数据：" + uuid);
                // var retVal = eval("(" + uuid + ")");
                // alert(retVal.date);
                alert("回调uuid为:" + uuid);
                $scope.load(uuid);
                $scope.uuid = uuid;
                var deviceId = $scope.uuid;
            }

            // $scope.items = [];
            // var idx = 0;
            // $scope.load = function() {
            //     //显示载入指示器
            //     $ionicLoading.show({
            //         template: "正在载入数据，请稍后..."
            //     });
            //     //延时2000ms来模拟载入的耗时行为
            //     $timeout(function(){
            //         for(var i=0;i<10;i++,idx++) $scope.items.unshift("item " + idx);
            //         //隐藏载入指示器
            //         $ionicLoading.hide();
            //     },2000);
            // };
            // window.localStorage.setItem("user",$("#signIn").text())


            $scope.user = {
                username: "",
                password: ""

            };

            $scope.signIn = function (user) {
                //$state.go("a", {
                //    username: $scope.user.username,
                //    password: $scope.user.password
                //
                //});
                $state.go("search");
            };

            //qq 登入
            $scope.qqclick = function () {
                var exec = cordova.require('cordova/exec');
                exec(qqLogin, qqLogin, "ThirdLoginPlugin", "qqLogin", [1])
            };
            function qqLogin(data) {
                alert("你成功连接IOS 插件 这是qqclick返回数据：" + data)
            }

//微信 登入
            $scope.wxclick = function () {
                var exec = cordova.require('cordova/exec');
                exec(wxLogin, wxLogin, "ThirdLoginPlugin", "wxLogin", [1])
            };

            function wxLogin(data) {
                alert("你成功连接IOS 插件 这是wxclick返回数据：" + data)
            }

//新浪 登入
            $scope.sinaclick = function () {
                var exec = cordova.require('cordova/exec');
                exec(sinaLogin, sinaLogin, "ThirdLoginPlugin", "sinaLogin", [1])
            };

            function sinaLogin(data) {
                alert("你成功连接IOS 插件 这是sinaclick返回数据：" + data)
            };
        }])
});

/**
 * 登入界面
 */
$(function () {
    //获取社保高度
    var height = $(window).height();
    var width = $(window).width();
    //自适应
//	$(".main").css('height', height);
//	$(".main").css('width', width);
    //自适应
    $(".ui-content").css('height', height);
    $(".ui-content").css('width', width);

    $("#newuser").css('margin-top', height - 20);
});
